package com.graduate.daydayup.fragment.mine

import android.content.Intent
import android.os.Build
import android.os.Bundle
import android.provider.AlarmClock
import android.view.View
import androidx.annotation.RequiresApi
import com.blankj.utilcode.util.ActivityUtils
import com.blankj.utilcode.util.SPUtils
import com.graduate.daydayup.App
import com.graduate.daydayup.R
import com.graduate.daydayup.activity.AboutActivity
import com.graduate.daydayup.activity.EditActivity
import com.graduate.daydayup.activity.LoginActivity
import com.graduate.daydayup.activity.NoteActivity
import com.graduate.daydayup.base.BaseFragment
import com.graduate.daydayup.room.MyRoomDataBase
import kotlinx.android.synthetic.main.activity_register.*
import kotlinx.android.synthetic.main.fragment_mine.*

class MineFragment :BaseFragment() {
    override fun getLayout()= R.layout.fragment_mine

    override fun initViewIds(view: View?) {
    }

    @RequiresApi(Build.VERSION_CODES.KITKAT)
    override fun initView(view: View?) {
        stv_account.setOnSuperTextViewClickListener {
            ActivityUtils.startActivity(EditActivity::class.java)
        }
        tv_account.setText(SPUtils.getInstance().getString("account"))
        stv_exit.setOnSuperTextViewClickListener {
            SPUtils.getInstance().put("account","")
            SPUtils.getInstance().put("password","")
            activity?.finish()
            ActivityUtils.startActivity(LoginActivity::class.java)
        }
        stv_aboutapp.setOnSuperTextViewClickListener {
            ActivityUtils.startActivity(AboutActivity::class.java)
        }
        stv_remind_set.setOnSuperTextViewClickListener {
            ActivityUtils.startActivity(Intent(AlarmClock.ACTION_SHOW_ALARMS))
        }
        stv_lessonnotes.setOnSuperTextViewClickListener {
            ActivityUtils.startActivity(NoteActivity::class.java)
        }
    }

    override fun initData(savedInstanceState: Bundle?) {

    }
}